#### Policy Issues

library(dplyr)
library(ggplot2)
library(ggpubr)


### Salience

load("PolicyIssuesComp.Rda")

br<- issues[ which(issues$Country=="bra"), ]


mean.p <- aggregate(PropPolicy~Issue, br, mean)
sd.p <- aggregate(PropPolicy~Issue, br, sd)
mean.sd <- cbind(mean.p, sd.p$PropPolicy)

names(mean.sd)[names(mean.sd) == 'sd.p$PropPolicy'] <- 'sd'

limits <- aes(ymax = PropPolicy + sd, ymin=PropPolicy - sd)

brplot<-ggplot(mean.sd, aes(x = reorder(Issue, -PropPolicy), y = PropPolicy)) +
  geom_point() + geom_pointrange(limits) + labs(x="",y="Issue Salience") +
  theme_bw() + theme(text=element_text(family="Arial Black", size=14)) +
  theme(axis.text.x=element_text(angle=90))

#

chi<- issues[ which(issues$Country=="chi"), ]


mean.p <- aggregate(PropPolicy~Issue, chi, mean)
sd.p <- aggregate(PropPolicy~Issue, chi, sd)
mean.sd <- cbind(mean.p, sd.p$PropPolicy)

names(mean.sd)[names(mean.sd) == 'sd.p$PropPolicy'] <- 'sd'

limits <- aes(ymax = PropPolicy + sd, ymin=PropPolicy - sd)

chiplot<-ggplot(mean.sd, aes(x = reorder(Issue, -PropPolicy), y = PropPolicy)) +
  geom_point() + geom_pointrange(limits) + labs(x="",y="Issue Salience") +
  theme_bw() + theme(text=element_text(family="Arial Black", size=14)) +
  theme(axis.text.x=element_text(angle=90))


#

col<- issues[ which(issues$Country=="col"), ]


mean.p <- aggregate(PropPolicy~Issue, col, mean)
sd.p <- aggregate(PropPolicy~Issue, col, sd)
mean.sd <- cbind(mean.p, sd.p$PropPolicy)

names(mean.sd)[names(mean.sd) == 'sd.p$PropPolicy'] <- 'sd'

limits <- aes(ymax = PropPolicy + sd, ymin=PropPolicy - sd)

colplot<-ggplot(mean.sd, aes(x = reorder(Issue, -PropPolicy), y = PropPolicy)) +
  geom_point() + geom_pointrange(limits) + labs(x="",y="Issue Salience") + 
  theme_bw() + theme(text=element_text(family="Arial Black", size=14)) +
  theme(axis.text.x=element_text(angle=90))








